package cn.seaboot.admin.starter.upload;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 文件上传配置
 *
 * @author Mr.css
 * @version 2019/12/7 17:10
 */
@Component
@ConfigurationProperties(prefix = "boot-upload")
public class UploadProperties {

    /**
     * 是否公开文件，选择是的话，可以通过ContextPath/seaboot/file/**
     * 访问用户所有的上传文件。
     * <p>
     * 这种技术，通过tomcat容器实现，系统内部无法拦截，需要权限的场景下，需要禁用此功能。
     */
    private Boolean isPublic;
    /**
     * 是否等到使用文件的时候才解析Request
     */
    private boolean resolveLazily;
    /**
     * 内存容量的最大值阈值，小于该值不生成临时文件，而直接放到内存中
     */
    private int maxInMemorySize = 10240;
    /**
     * 上传文件的总容量大小
     */
    private long maxUploadSize = 50 * 1024 * 1024L;
    /**
     * PDF水印
     */
    private String pdfMark = "From SeaAdmin";

    /**
     * 根目录
     */
    private String root;
    /**
     * 文件存储路径
     */
    private String filePath;
    /**
     * 图片存放路径
     */
    private String imagePath;
    /**
     * Excel存放路径
     */
    private String excelPath;
    /**
     * word存放路径
     */
    private String wordPath;
    /**
     * app存储路径
     */
    private String appPath;

    public Boolean getPublic() {
        return isPublic;
    }

    public void setPublic(Boolean aPublic) {
        isPublic = aPublic;
    }

    public boolean isResolveLazily() {
        return resolveLazily;
    }

    public void setResolveLazily(boolean resolveLazily) {
        this.resolveLazily = resolveLazily;
    }

    public int getMaxInMemorySize() {
        return maxInMemorySize;
    }

    public void setMaxInMemorySize(int maxInMemorySize) {
        this.maxInMemorySize = maxInMemorySize;
    }

    public long getMaxUploadSize() {
        return maxUploadSize;
    }

    public void setMaxUploadSize(long maxUploadSize) {
        this.maxUploadSize = maxUploadSize;
    }

    public String getPdfMark() {
        return pdfMark;
    }

    public void setPdfMark(String pdfMark) {
        this.pdfMark = pdfMark;
    }

    public String getRoot() {
        return root;
    }

    public void setRoot(String root) {
        this.root = root;
    }

    public String getFilePath() {
        return filePath;
    }

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    public String getImagePath() {
        return imagePath;
    }

    public void setImagePath(String imagePath) {
        this.imagePath = imagePath;
    }

    public String getExcelPath() {
        return excelPath;
    }

    public void setExcelPath(String excelPath) {
        this.excelPath = excelPath;
    }

    public String getWordPath() {
        return wordPath;
    }

    public void setWordPath(String wordPath) {
        this.wordPath = wordPath;
    }

    public String getAppPath() {
        return appPath;
    }

    public void setAppPath(String appPath) {
        this.appPath = appPath;
    }

    @Override
    public String toString() {
        return "FileUploadConstant{" +
                "isPublic=" + isPublic +
                ", resolveLazily=" + resolveLazily +
                ", maxInMemorySize=" + maxInMemorySize +
                ", maxUploadSize=" + maxUploadSize +
                ", pdfMark='" + pdfMark + '\'' +
                ", root='" + root + '\'' +
                ", filePath='" + filePath + '\'' +
                ", imagePath='" + imagePath + '\'' +
                ", excelPath='" + excelPath + '\'' +
                ", wordPath='" + wordPath + '\'' +
                ", appPath='" + appPath + '\'' +
                '}';
    }
}
